<?php
/**
 * Init
 * Created by Veyron
 * motto:现在的拼搏 为了更好的明天
 * day:  2020/3/23
 * Time: 21:54
 */

namespace app\api\controller\mall;

use app\api\controller\ApiBase;
use app\api\controller\AuthBase;
use app\common\business\Cart;
use app\common\lib\Show;

class Init extends AuthBase
{
    public function index(){
        if(!$this->request->isPost()){
            return Show::error('非法访问');
        }
        $count = (new Cart())->getCount($this->userId);
        $result = [
            'cart_num'  => $count,
        ];
        return Show::success($result);
    }
}
